﻿<UserControl
    x:Class="DvachBrowser3.Views.Partial.SearchBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DvachBrowser3.Views.Partial"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    xmlns:behaviors="using:DvachBrowser3.Behaviors"
    xmlns:core="using:Microsoft.Xaml.Interactions.Core"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="300">
    
    <UserControl.Resources>
        <Storyboard x:Name="ShowAnimation">
            <DoubleAnimation Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="Opacity" From="0.5" To="1.0" Duration="0:0:0.1" />
            <DoubleAnimation Storyboard.TargetName="MainBorderTransform" Storyboard.TargetProperty="X" From="32" To="0" Duration="0:0:0.1">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseIn" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="HideAnimation" Completed="HideAnimation_OnCompleted">
            <DoubleAnimation Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="Opacity" From="1.0" To="0.5" Duration="0:0:0.1" />
            <DoubleAnimation Storyboard.TargetName="MainBorderTransform" Storyboard.TargetProperty="X" From="0" To="32" Duration="0:0:0.1">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseOut" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
    </UserControl.Resources>

    <Border Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Padding="8" x:Name="MainBorder">
        <Border.RenderTransform>
            <TranslateTransform x:Name="MainBorderTransform"/>
        </Border.RenderTransform>
        <StackPanel>
            <TextBox x:Name="EntryBox" PlaceholderText="Поиск">
                <interactivity:Interaction.Behaviors>
                    <behaviors:TextBoxChangeDelayBehavior>
                        <core:CallMethodAction TargetObject="{x:Bind}" MethodName="ApplyFilter" />
                    </behaviors:TextBoxChangeDelayBehavior>
                </interactivity:Interaction.Behaviors>
            </TextBox>
        </StackPanel>
    </Border>
</UserControl>

